package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysYongyouCgrkMapper;
import com.ruoyi.system.domain.SysYongyouCgrk;
import com.ruoyi.system.service.ISysYongyouCgrkService;

/**
 * 采购入库Service业务层处理
 * 
 * @author SYF
 * @date 2025-04-18
 */
@Service
public class SysYongyouCgrkServiceImpl implements ISysYongyouCgrkService 
{
    @Autowired
    private SysYongyouCgrkMapper sysYongyouCgrkMapper;

    /**
     * 查询采购入库
     * 
     * @param vouchdate 采购入库主键
     * @return 采购入库
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public SysYongyouCgrk selectSysYongyouCgrkByVouchdate(String vouchdate)
    {
        return sysYongyouCgrkMapper.selectSysYongyouCgrkByVouchdate(vouchdate);
    }

    /**
     * 查询采购入库列表
     * 
     * @param sysYongyouCgrk 采购入库
     * @return 采购入库
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public List<SysYongyouCgrk> selectSysYongyouCgrkList(SysYongyouCgrk sysYongyouCgrk)
    {
        return sysYongyouCgrkMapper.selectSysYongyouCgrkList(sysYongyouCgrk);
    }

    /**
     * 新增采购入库
     * 
     * @param sysYongyouCgrk 采购入库
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int insertSysYongyouCgrk(SysYongyouCgrk sysYongyouCgrk)
    {
        return sysYongyouCgrkMapper.insertSysYongyouCgrk(sysYongyouCgrk);
    }

    /**
     * 修改采购入库
     * 
     * @param sysYongyouCgrk 采购入库
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int updateSysYongyouCgrk(SysYongyouCgrk sysYongyouCgrk)
    {
        return sysYongyouCgrkMapper.updateSysYongyouCgrk(sysYongyouCgrk);
    }

    /**
     * 批量删除采购入库
     * 
     * @param vouchdates 需要删除的采购入库主键
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteSysYongyouCgrkByVouchdates(String[] vouchdates)
    {
        return sysYongyouCgrkMapper.deleteSysYongyouCgrkByVouchdates(vouchdates);
    }

    /**
     * 删除采购入库信息
     * 
     * @param vouchdate 采购入库主键
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteSysYongyouCgrkByVouchdate(String vouchdate)
    {
        return sysYongyouCgrkMapper.deleteSysYongyouCgrkByVouchdate(vouchdate);
    }

    @Override
    @DataSource(DataSourceType.SLAVE)
    public int deleteByDateRange(String startDate)
    {
        return sysYongyouCgrkMapper.deleteByDateRange(startDate);
    }
}
